/*
	Switching mechanism;
	swState :
		0 ... no switch;
		1 ... MCT(iEC) -> BFP(iPC)
		2 ... BFP(iPC) -> MCT(iEC)
*/
int swState 	= 0;
int swTime	= 10;

#define INDMAX 1000

#define SPECIES 23
#define REACTIONS 47

int species[SPECIES];
int reactants[REACTIONS][SPECIES]	= {0};
int products[REACTIONS][SPECIES]	= {0};
int dif[REACTIONS][SPECIES]			= {0};
float w[REACTIONS]					= {0};
float c[REACTIONS]					= {0};



/*Parameters*/

/*
float g1 	= 0.1;
float a_1 	= 0.3;
float a1 	= 0.9;
float k1 	= 0.8;
float b1	= 0.001;
float d1	= 0.01;

float g1 	= ELEMENT[BLINDEX].vector[0];
float a_1 	= ELEMENT[BLINDEX].vector[1];
float a1 	= ELEMENT[BLINDEX].vector[2];
float k1 	= ELEMENT[BLINDEX].vector[3];
float b1	= ELEMENT[BLINDEX].vector[4];
float d1	= ELEMENT[BLINDEX].vector[5];
*/

/*Species*/
#define BFP		0
#define mCITRINE	1
#define P1		2
#define P1_TALA_KRAB	3
#define P1_TALA_VP16	4	
#define TALA_KRAB	5
#define TALA_VP16	6
#define TALB_KRAB	7
#define TALB_VP16	8
#define P2		9
#define P2_TALB_KRAB	10
#define P2_TALB_VP16	11
#define P3		12
#define P3_PIP_KRAB	13
#define PIP_KRAB	14
#define P4		15
#define P4_E_KRAB	16
#define E_KRAB		17
#define P5		18
#define iPC		19
#define iEC		20
#define iPC_PIP_KRAB	21
#define iEC_E_KRAB	22

	


species[BFP] 			= 0;
species[mCITRINE] 		= 0;
species[P1] 			= 100;
species[P1_TALA_KRAB] 		= 0;
species[P1_TALA_VP16]		= 0;
species[TALA_KRAB] 		= 0;
species[TALA_VP16] 		= 0;
species[TALB_KRAB] 		= 0;
species[TALB_VP16] 		= 0;
species[P2] 			= 100;
species[P2_TALB_KRAB] 		= 0;
species[P2_TALB_VP16] 		= 0;
species[P3] 			= 300;
species[P3_PIP_KRAB]		= 0;
species[PIP_KRAB] 		= 0;
species[P4] 			= 300;	
species[P4_E_KRAB] 		= 0;
species[E_KRAB] 		= 0;
species[P5] 			= 500;
species[iPC] 			= 0;
species[iEC] 			= 0;
species[iPC_PIP_KRAB]		= 0;
species[iEC_E_KRAB] 		= 0;

/*	
species[BFP] 			= 1;
species[mCITRINE] 		= 1;
species[P1] 			= 100;
species[P1_TALA_KRAB] 		= 1;
species[P1_TALA_VP16]		= 1;
species[TALA_KRAB] 		= 1;
species[TALA_VP16] 		= 1;
species[TALB_KRAB] 		= 1;
species[TALB_VP16] 		= 1;
species[P2] 			= 100;
species[P2_TALB_KRAB] 		= 1;
species[P2_TALB_VP16] 		= 1;
species[P3] 			= 300;
species[P3_PIP_KRAB]		= 1;
species[PIP_KRAB] 		= 1;
species[P4] 			= 300;	
species[P4_E_KRAB] 		= 1;
species[E_KRAB] 		= 1;
species[P5] 			= 500;
species[iPC] 			= 1;
species[iEC] 			= 1;
species[iPC_PIP_KRAB]		= 1;
species[iEC_E_KRAB] 		= 1;
	*/



	
	
	
/*tau-leaping aux*/
float fjj[REACTIONS][REACTIONS] = { 0 };
	
/*Reactions*/	


/*P1*/
		
c[0] = k1;
reactants[0][P1_TALA_VP16] = 1;
//--------------------------//
products[0][P1_TALA_VP16] = 1;
products[0][TALB_KRAB] = 1;
products[0][TALA_VP16] = 1;
products[0][BFP] = 1;
#define W0 w[0] = c[0] * species[P1_TALA_VP16];
//--------------------------//
fjj[0][3] = c[0]*dif[3][P1_TALA_VP16];
fjj[0][4] = c[0]*dif[4][P1_TALA_VP16];
fjj[0][5] = c[0]*dif[5][P1_TALA_VP16];
fjj[0][6] = c[0]*dif[6][P1_TALA_VP16];

        
c[1] = b1;
reactants[1][P1] = 1;
//--------------------------//
products[1][P1] = 1;
products[1][TALB_KRAB] = 1;
products[1][TALA_VP16] = 1;
products[1][BFP] = 1;
#define W1 w[1] = c[1] * species[P1];


	
c[2] = 0.1*b1;
reactants[2][P1_TALA_KRAB] = 1;
//--------------------------//
products[2][P1_TALA_KRAB] = 1;
products[2][TALB_KRAB] = 1;
products[2][TALA_VP16] = 1;
products[2][BFP] = 1;
#define W2 w[2] = c[2] * species[P1_TALA_KRAB];



c[3] = a1;
reactants[3][P1] = 1;
reactants[3][TALA_VP16] = 1;
//--------------------------//
products[3][P1_TALA_VP16] = 1;
#define W3 w[3] = c[3] * species[P1]*species[TALA_VP16];



c[4] = a_1;
reactants[4][P1_TALA_VP16] = 1;
//--------------------------//
products[4][P1] = 1;
products[4][TALA_VP16] = 1;
#define W4 w[4] = c[4] * species[P1_TALA_VP16];

c[5] = d1;
reactants[5][P1_TALA_VP16] = 1;
//--------------------------//
products[5][P1] = 1;
#define W5 w[5] = c[5] * species[P1_TALA_VP16];


c[6] = a1;
reactants[6][P1_TALA_VP16] = 1;
reactants[6][TALA_KRAB] = 1;
//--------------------------//
products[6][P1_TALA_KRAB] = 1;
#define W6 w[6] = c[6] * species[P1_TALA_VP16] * species[TALA_KRAB];


c[7] = a1;
reactants[7][P1] = 1;
reactants[7][TALA_KRAB] = 1;
//--------------------------//
products[7][P1_TALA_KRAB] = 1;
#define W7 w[7] = c[7] * species[P1] * species[TALA_KRAB];



c[8] = a_1;
reactants[8][P1_TALA_KRAB] = 1;
//--------------------------//
products[8][P1] = 1;
products[8][TALA_KRAB] = 1;
#define W8 w[8] = c[8] * species[P1_TALA_KRAB];


c[9] = d1;
reactants[9][P1_TALA_KRAB] = 1;
//--------------------------//
products[9][P1] = 1;
#define W9 w[9] = c[9] * species[P1_TALA_KRAB];



/*P2*/



c[10] = k1;
reactants[10][P2_TALB_VP16] = 1;
//--------------------------//
products[10][P2_TALB_VP16] = 1;
products[10][TALA_KRAB] = 1;
products[10][TALB_VP16] = 1;
products[10][mCITRINE] = 1;
#define W10 w[10] = c[10] * species[P2_TALB_VP16];





c[11] = b1;
reactants[11][P2] = 1;
//--------------------------//
products[11][P2] = 1;
products[11][TALA_KRAB] = 1;
products[11][TALB_VP16] = 1;
products[11][mCITRINE] = 1;
#define W11 w[11] = c[11] * species[P2];




c[12] = 0.01*b1;
reactants[12][P2_TALB_KRAB] = 1;
//--------------------------//
products[12][P2_TALB_KRAB] = 1;
products[12][TALA_KRAB] = 1;
products[12][TALB_VP16] = 1;
products[12][mCITRINE] = 1;
#define W12 w[12] = c[12] * species[P2_TALB_KRAB];



c[13] = a1;
reactants[13][P2] = 1;
reactants[13][TALB_VP16] = 1;
//--------------------------//
products[13][P2_TALB_VP16] = 1;
#define W13 w[13] = c[13] * species[P2]*species[TALB_VP16];


c[14] = a_1;
reactants[14][P2_TALB_VP16] = 1;
//--------------------------//
products[14][P2] = 1;
products[14][TALB_VP16] = 1;
#define W14 w[14] = c[14] * species[P2_TALB_VP16];

c[15] = d1;
reactants[15][P2_TALB_VP16] = 1;
//--------------------------//
products[15][P2] = 1;
#define W15 w[15] = c[15] * species[P2_TALB_VP16];



c[16] = a1;
reactants[16][P2_TALB_VP16] = 1;
reactants[16][TALB_KRAB] = 1;
//--------------------------//
products[16][P2_TALB_KRAB] = 1;
//NAPAKA! #define W16 w[16] = c[16] * species[P2_TALB_VP16];
#define W16 w[16] = c[16] * species[P2_TALB_VP16] * species[TALB_KRAB];





c[17] = a1;
reactants[17][P2] = 1;
reactants[17][TALB_KRAB] = 1;
//--------------------------//
products[17][P2_TALB_KRAB] = 1;
#define W17 w[17] = c[17] * species[P2] * species[TALB_KRAB];


c[18] = a_1;
reactants[18][P2_TALB_KRAB] = 1;
//--------------------------//
products[18][P2] = 1;
products[18][TALB_KRAB] = 1;
#define W18 w[18] = c[18] * species[P2_TALB_KRAB];




c[19] = d1;
reactants[19][P2_TALB_KRAB] = 1;
//--------------------------//
products[19][P2] = 1;
#define W19 w[19] = c[19] * species[P2_TALB_KRAB];




/*P3*/

c[20] = g1;
reactants[20][P3] = 1;
//--------------------------//
products[20][P3] = 1;
products[20][TALB_KRAB] = 1;
products[20][TALA_VP16] = 1;
#define W20 w[20] = c[20] * species[P3];



c[21] = b1;
reactants[21][P3_PIP_KRAB] = 1;
//--------------------------//
products[21][P3_PIP_KRAB] = 1;
products[21][TALB_KRAB] = 1;
products[21][TALA_VP16] = 1;
#define W21 w[21] = c[21] * species[P3_PIP_KRAB];




c[22] = a1;
reactants[22][P3] = 1;
reactants[22][PIP_KRAB] = 1;
//--------------------------//
products[22][P3_PIP_KRAB] = 1;
//NAPAKA #define W22 w[22] = c[22] * species[P3];
#define W22 w[22] = c[22] * species[P3] * species[PIP_KRAB];

c[23] = a_1;
reactants[23][P3_PIP_KRAB] = 1;
//--------------------------//
products[23][P3] = 1;
products[23][PIP_KRAB] = 1;
#define W23 w[23] = c[23] * species[P3_PIP_KRAB];


c[24] = d1;
reactants[24][P3_PIP_KRAB] = 1;
//--------------------------//
products[24][P3] = 1;
#define W24 w[24] = c[24] * species[P3_PIP_KRAB];



c[25] = g1;
reactants[25][P4] = 1;
//--------------------------//
products[25][P4] = 1;
products[25][TALA_KRAB] = 1;
products[25][TALB_VP16] = 1;
#define W25 w[25] = c[25] * species[P4];


c[26] = b1;
reactants[26][P4_E_KRAB] = 1;
//--------------------------//
products[26][P4_E_KRAB] = 1;
products[26][TALA_KRAB] = 1;
products[26][TALB_VP16] = 1;
#define W26 w[26] = c[26] * species[P4_E_KRAB];


c[27] = a1;
reactants[27][P4] = 1;
reactants[27][E_KRAB] = 1;
//--------------------------//
products[27][P4_E_KRAB] = 1;
#define W27 w[27] = c[27] * species[P4] * species[E_KRAB];


c[28] = a_1;
reactants[28][P4_E_KRAB] = 1;
//--------------------------//
products[28][P4] = 1;
products[28][E_KRAB] = 1;
#define W28 w[28] = c[28] * species[P4_E_KRAB];

c[29] = d1;
reactants[29][P4_E_KRAB] = 1;
//--------------------------//
products[29][P4] = 1;
#define W29 w[29] = c[29] * species[P4_E_KRAB];



/*P5*/
c[30] = g1;
reactants[30][P5] = 1;
//--------------------------//
products[30][P5] = 1;
products[30][PIP_KRAB] = 1;
products[30][E_KRAB] = 1;
#define W30 w[30] = c[30] * species[P5];


/*Inducer system*/
c[31] = a1;
reactants[31][iPC] = 1;
reactants[31][PIP_KRAB] = 1;
//--------------------------//
products[31][iPC_PIP_KRAB] = 1;
//NAPAKA #define W31 w[31] = c[31] * species[iPC];
#define W31 w[31] = c[31] * species[iPC] * species[PIP_KRAB];



c[32] = a_1;
reactants[32][iPC_PIP_KRAB] = 1;
//--------------------------//
products[32][iPC] = 1;
products[32][PIP_KRAB] = 1;
#define W32 w[32] = c[32] * species[iPC_PIP_KRAB];



c[33] = d1;
reactants[33][iPC_PIP_KRAB] = 1;
//--------------------------//
products[33][iPC] = 1;
#define W33 w[33] = c[33] * species[iPC_PIP_KRAB];



c[34] = a1;
reactants[34][iEC] = 1;
reactants[34][E_KRAB] = 1;
//--------------------------//
products[34][iEC_E_KRAB] = 1;
#define W34 w[34] = c[34] * species[iEC] * species[E_KRAB];



c[35] = a_1;
reactants[35][iEC_E_KRAB] = 1;
//--------------------------//
products[35][iEC] = 1;
products[35][E_KRAB] = 1;
#define W35 w[35] = c[35] * species[iEC_E_KRAB];


c[36] = d1;
reactants[36][iEC_E_KRAB] = 1;
//--------------------------//
products[36][iEC] = 1;
#define W36 w[36] = c[36] * species[iEC_E_KRAB];



/*Degradation*/;

c[37] = d1;
reactants[37][BFP] = 1;
//--------------------------//
#define W37 w[37] = c[37] * species[BFP];




c[38] = d1;
reactants[38][mCITRINE] = 1;
//--------------------------//
#define W38 w[38] = c[38] * species[mCITRINE];


c[39] = d1;
reactants[39][TALA_KRAB] = 1;
//--------------------------//
#define W39 w[39] = c[39] * species[TALA_KRAB];



c[40] = d1;
reactants[40][TALA_VP16] = 1;
//--------------------------//
#define W40 w[40] = c[40] * species[TALA_VP16];


c[41] = d1;
reactants[41][TALB_KRAB] = 1;
//--------------------------//
#define W41 w[41] = c[41] * species[TALB_KRAB];


c[42] = d1;
reactants[42][TALB_VP16] = 1;
//--------------------------//
#define W42 w[42] = c[42] * species[TALB_VP16];




c[43] = d1;
reactants[43][PIP_KRAB] = 1;
//--------------------------//
#define W43 w[43] = c[43] * species[PIP_KRAB];



c[44] = d1;
reactants[44][E_KRAB] = 1;
//--------------------------//
#define W44 w[44] = c[44] * species[E_KRAB];




/*Inducer system*/

c[45] = a1;
reactants[45][P3_PIP_KRAB] = 1;
reactants[45][iPC] = 1;
//--------------------------//
products[45][P3] = 1;
products[45][iPC_PIP_KRAB] = 1;
#define W45 w[45] = c[45] * species[P3_PIP_KRAB] * species[iPC];





c[46] = a1;
reactants[46][P4_E_KRAB] = 1;
reactants[46][iEC] = 1;
//--------------------------//
products[46][P4] = 1;
products[46][iEC_E_KRAB] = 1;
#define W46 w[46] = c[46] * species[P4_E_KRAB] * species[iEC];
